const fnObj ={
    search:(data,keyWord)=>{
        let search =data.filter(item=>{
            return item.content.includes(keyWord)
        })
        return search
    }
}
onmessage = function (e) {
    const { data } = e;
    const res = fnObj[data.function](data.data,data.keyWord)
    // 将获取的数据通过postMessage发送到主线程
    self.postMessage({
        data: res,
        name: 'worker test'
    })
    self.close()
}